<!DOCTYPE stack PUBLIC "-//Apple, Inc.//DTD stack V 2.0//EN" "" >
<stack>
<name>in</name>
<id>-1</id>
<cardCount>1</cardCount>
<cardID>3066</cardID>
<listID>3828</listID>
<cantModify><true /></cantModify>
<cantDelete><false /></cantDelete>
<cantAbort><false /></cantAbort>
<cardSize>
<width>416</width>
<height>240</height>
</cardSize>
<script>-- Region XCMD support scripts-- © 1990, Nigel Perry. Free for personal use.-- May not be used for commercial, profit-making or in ShareWare-- without permission.-- add menu item for creation-- make sure BMTR trap existson setupRegionsinstall_BMTRif "Objects" is in the menus thenif "New Region…" is not in menu "Objects" thenput "New Region…" before menuItem "New Button" ¬of menu "Objects" with menuMessage "Region new"end ifend ifif "Edit" is in the menus thenif "Regions…" is not in menu "Edit" thenput "Regions…" after menuItem "Icon..." ¬of menu "Edit" with menuMessage "Region edit"end ifend ifend setupRegions-- remove menu itemon cleanupRegionsif "Objects" is in the menus thenif "New Region…" is in menu "Objects" thendelete menuItem "New Region…" of menu "Objects"end ifend ifif "Edit" is in the menus thenif "Regions…" is in menu "Edit" thendelete menuItem "Regions…" of menu "Edit"end ifend ifend cleanupRegions-- support clip to PICT conversionon doMenu cmdif cmd is "Paste Picture" and the optionKey is downthenget the long name of this stackput word 2 of it into pathdelete char 1 of pathdelete last char of pathRegion pastePICT,pathelsepass doMenuend ifend doMenu-- support edit mode selectionon choose ignore,toolif tool ≤ 3 and the optionKey is downthenRegion edit,toolelseRegion normalend ifpass chooseend choose-- toggle palette just like the Tools oneon keyDown keyif key is tab and the optionKey is down thenif "Region Palette" is in the windows thenset the visible of window "Region Palette" to ¬not the visible of window "Region Palette"end ifend ifpass keyDownend keyDown-- create a script to create a Region-- designed to be called by Region XCMD onlyfunction _dump_Region whereglobal targetRegionglobal _region_handlerset cursor to busyput return & "on" && _region_handler & return into handlerput the picture of window targetRegion into pictput the region of window targetRegion into regionput the rect of window targetRegion into rectput "Region" && targetRegion & "," ¬& quote & rect & quote & "," ¬& quote & pict & quote & "," ¬& quote & region & quote & return after handlerset cursor to busyput the mouseDown of window targetRegion into handif hand is not empty thenput "set the mouseDown of window" && targetRegion ¬&& "to" && _literal(hand) & return after handlerend ifset cursor to busyput the mouseWithin of window targetRegion into handif hand is not empty thenput "set the mouseWithin of window" && targetRegion ¬&& "to" && _literal(hand) & return after handlerend ifset cursor to busyput the mouseStillDown of window targetRegion into handif hand is not empty thenput "set the mouseStillDown of window" && targetRegion ¬&& "to" && _literal(hand) & return after handlerend ifset cursor to busyput the mouseUp of window targetRegion into handif hand is not empty thenput "set the mouseUp of window" && targetRegion ¬&& "to" && _literal(hand) & return after handlerend ifset cursor to busyput the idle of window targetRegion into handif hand is not empty thenput "set the idle of window" && targetRegion ¬&& "to" && _literal(hand) & return after handlerend ifset cursor to busyput the idleTime of window targetRegion into valif val ≠ 0 thenput "set the idleTime of window" && targetRegion ¬&& "to" && val & return after handlerend ifset cursor to busyif the autoHilite of window targetRegion thenput "set the autoHilite of window" && targetRegion ¬&& "to true" & return after handlerend ifput "end" && _region_handler & return after handlerput empty into _region_handlerif where = 0 then -- cardput the script of this cd into xset cursor to busyset the script of this cd to (x & handler)else if where = 1 then -- bgput the script of this bg into xset cursor to busyset the script of this bg to (x & handler)else if where = 2 then -- stkput the script of this stack into xset cursor to busyset the script of this stack to (x & handler)else -- clipreturn handlerend ifreturn emptyend _dump_Region-- convert text into a literal stringfunction _literal textput quote into ansrepeat with i = 1 to the number of chars in textput char i of text into cif c = quote thenput quote && "& quote &" && quote after anselse if c = return thenput quote && "& return & ¬" & return & quote after anselseput c after ansend ifset cursor to busyend repeatput quote after ansreturn ansend _literalfunction _edit_Region_Scriptglobal targetRegionglobal _region_handlerreturn EditScript("the" && _region_handler && "of window" && targetRegion, ¬_region_handler && "of region" && targetRegion, ¬"set the" && _region_handler && "of window" && targetRegion && "to editResult")end _edit_Region_Scripton testEditglobal targetRegionglobal _region_handlerask "Region?"put it into targetRegionask "Handler?"put it into _region_handlerif not _edit_Region_Script() thenanswer "Failed"end ifend testEdit</script>